from django.contrib import admin
from .models import Question,QuestionType,Choice,Answer
# Register your models here.

admin.site.register(QuestionType)

class ChoiceInline(admin.StackedInline):
    model = Choice
    extra = 2
class AnswerInline(admin.StackedInline):
    model = Answer
    extra = 1

class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
	('添加问题', {'fields': ['question_type']}),
        (None, {'fields': ['question_text']}),
        #('Date information', {'fields': ['pub_date']}),
    ]
	
    inlines = [ChoiceInline,AnswerInline]
admin.site.register(Question, QuestionAdmin)
